package service

import (
	"github.com/go-admin-team/go-admin-core/sdk/service"
	"tuowei.com/app/admin/models"
)

type TeachingPointService struct {
	service.Service
}

type ConditionDept struct {
	models.SysDept
	Children []*ConditionDept
}

// teacherId 招生老师的userid
func (s TeachingPointService) GetCondition(teacherId int) []models.SysTeachingPointSimple {
	pointIds := make([]int, 0)
	s.Orm.Table(models.SysTeachingPoint2teacher{}.TableName()).Where("enrollment_id = ?", teacherId).
		Pluck("point_id", &pointIds)
	lists := make([]models.SysTeachingPointSimple, 0)
	if len(pointIds) == 0 {
		return lists
	}
	s.Orm.Where("id in (?)", pointIds).Find(&lists)
	return lists

}
